<html>
<head>
<title>RChart, User Guide</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" leftmargin="35">
<h3>RCHART, User Guide</h3>
<p><font face="Arial, Helvetica, sans-serif" size="-1"><i>Copyright 2005, J4L 
  Components (http://www.java4less.com)</i></font> <br>
  <a href="tutorialcontents.html">Go bak to contents</a></p>
<hr>
<h3><font face="Arial, Helvetica, sans-serif">The Chart API</font></h3>
<ul>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"><a href="#0">Chart creation 
    process</a></font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"><a href="#1">The ChartLoader</a></font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"><a href="#viewer">Displaying 
    the chart (Chart viewer)</a><br>
    </font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"><a href="#2">Exporting 
    the chart to gif , png or jpg</a></font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"><a href="#4">Updating 
    the chart and realtime update</a></font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"><a href="#5">Recompiling 
    Rchart</a></font></li>
</ul>
<h4>&nbsp;</h4>
<h4><font face="Arial, Helvetica, sans-serif" size="-1"><a name="0"></a>Chart 
  creation process</font></h4>
<p><font face="Arial, Helvetica, sans-serif" size="-1">We recommend you to create 
  charts using the parameters provided by RChart Visual Builder, however if you 
  need it you can create charts using the Java API (see the Java documentation 
  in the<i> javadoc</i> subdirectory of your installation).</font></p>
<p><font face="Arial, Helvetica, sans-serif" size="-1">The process is:</font></p>
<div align="center"></div>
<div align="center"> 
  <table width="95%" border="0">
    <tr> 
      <td valign="top" width="50%">1. Import RChart package</td>
      <td> import com.java4less.rchart.*;<br>
        import com.java4less.rchart.gc.*; </td>
    </tr>
    <tr> 
      <td valign="top" width="50%">2. Create the title</td>
      <td>Title title=new Title("Sales (thousands $)")</td>
    </tr>
    <tr> 
      <td valign="top" width="50%">3. Create the axis you need (depends on the 
        chart, for example piecharts do not have axis) </td>
      <td>com.java4less.rchart.Axis XAxis=new Axis(Axis.HORIZONTAL,new Scale());<br>
        com.java4less.rchart.Axis YAxis=new Axis(Axis.VERTICAL,new Scale()); <br>
        XAxis.scale.min=0; <br>
        YAxis.scale.min=0; <br>
        ..... </td>
    </tr>
    <tr> 
      <td valign="top" width="50%">4. Create the legend</td>
      <td> Legend l=new Legend();<br>
        l.addItem("Products",new FillStyle( GraphicsProvider.getColor(ChartColor.BLUE)) 
        )); <br>
        l.addItem("Services",new FillStyle( GraphicsProvider.getColor(ChartColor.GREEN)) 
        )); </td>
    </tr>
    <tr> 
      <td width="50%">5. Create the axis labels</td>
      <td> 
        <p>XLabel= new HAxisLabel("", GraphicsProvider.getColor(ChartColor.BLUE)), 
          GraphicsProvider.getFont("Arial",ChartFont.BOLD,14));</p>
        <p>YLabel= new VAxisLabel("Brutto", GraphicsProvider.getColor(ChartColor.BLACK)),new 
          GraphicsProvider.getFont("Arial",ChartFont.BOLD,14));</p>
      </td>
    </tr>
    <tr> 
      <td width="50%">6. create the plotter (or plotters if you combine lines 
        and bars)</td>
      <td>LinePlotter3D plot=new LinePlotter3D();</td>
    </tr>
    <tr> 
      <td width="50%">7. create the chart and set properties (labels,legend)</td>
      <td>com.java4less.rchart.Chart chart=new Chart(title,plot,XAxis,YAxis);<br>
        chart.XLabel=XLabel; <br>
        chart.YLabel=YLabel; <br>
        chart.legend=l; </td>
    </tr>
    <tr> 
      <td width="50%">8. create the data series</td>
      <td>double[] d1={1,1,3,3.5,5,4,2};<br>
        LineDataSerie data1= new LineDataSerie(d1,new LineStyle(0.2f, GraphicsProvider.getColor(ChartColor.BLUE)) 
        ,LineStyle.LINE_NORMAL)); </td>
    </tr>
    <tr> 
      <td width="50%">9. add serie to chart</td>
      <td>chart.addSerie(data1);</td>
    </tr>
    <tr> 
      <td width="50%">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</div>
<p align="center">&nbsp;</p>
<p>&nbsp;</p>
<h4><font face="Arial, Helvetica, sans-serif" size="-1"><a name="1"></a>The ChartLoader 
  </font></h4>
<p><font face="Arial, Helvetica, sans-serif" size="-1">You can use the chart loader 
  to create the charts using the parameters created by RChart Visual Builder in 
  this way:</font></p>
<blockquote> 
  <blockquote> 
    <blockquote> 
      <p><font size="-1" face="Arial, Helvetica, sans-serif">import com.java4less.rchart.*;</font></p>
      <p><font size="-1" face="Arial, Helvetica, sans-serif">public class test{<br>
        public test() {<br>
        }<br>
        public static void main(String[] args) {<br>
        try {</font></p>
      <p><font size="-1" face="Arial, Helvetica, sans-serif">ChartLoader loader=new 
        ChartLoader();<br>
        <b>// Set parameters</b><br>
        loader.setParameter(&quot;TITLECHART&quot;,&quot;Sales 1999&quot;);<br>
        loader.setParameter(&quot;LEGEND_FILL&quot;,&quot;WHITE&quot;);<br>
        loader.setParameter(&quot;LEGEND_VERTICAL&quot;,&quot;FALSE&quot;);<br>
        loader.setParameter(&quot;LEGEND_BORDER&quot;,&quot;0.2|0x0|NORMAL&quot;);<br>
        loader.setParameter(&quot;SERIE_1&quot;,&quot;Pie&quot;);<br>
        loader.setParameter(&quot;SERIE_TYPE_1&quot;,&quot;PIE&quot;);<br>
        loader.setParameter(&quot;SERIE_FONT_1&quot;,&quot;ARIAL|BOLD|12&quot;);<br>
        loader.setParameter(&quot;SERIE_DATA_1&quot;,&quot;94|48|28&quot;);<br>
        loader.setParameter(&quot;PIE_NAME_1&quot;,&quot;Products&quot;);<br>
        loader.setParameter(&quot;PIE_NAME_2&quot;,&quot;Services&quot;);<br>
        loader.setParameter(&quot;PIE_NAME_3&quot;,&quot;Other&quot;);<br>
        loader.setParameter(&quot;PIE_STYLE_1&quot;,&quot;RED&quot;);<br>
        loader.setParameter(&quot;PIE_STYLE_2&quot;,&quot;BLUE&quot;);<br>
        loader.setParameter(&quot;PIE_STYLE_3&quot;,&quot;GREEN&quot;);<br>
        loader.setParameter(&quot;PIECHART_3D&quot;,&quot;true&quot;);<br>
        loader.setParameter(&quot;PIE_LABEL_FORMAT&quot;,&quot;#VALUE# (#PERCENTAGE#)&quot;);<br>
        loader.setParameter(&quot;SERIE_LABELS_1&quot;,&quot;Products|Services|Other&quot;);<br>
        loader.setParameter(&quot;SERIE_TOGETHER_1&quot;,&quot;true|false|true&quot;);<br>
        loader.setParameter(&quot;LEGEND_POSITION&quot;,&quot;TOP&quot;);<br>
        loader.setParameter(&quot;LEGEND_MARGIN&quot;,&quot;0.3&quot;);<br>
        loader.setParameter(&quot;CHART_BORDER&quot;,&quot;0.2|0x0|NORMAL&quot;);<br>
        loader.setParameter(&quot;CHART_FILL&quot;,&quot;0x99cccc&quot;);</font></p>
      <p><font size="-1" face="Arial, Helvetica, sans-serif"><b>/* process parameters 
        and create chart*/</b><br>
        Chart chart=loader.buildChart(false,false);<br>
        chart.setSize(300,300);<br>
        </font></p>
      <p><font size="-1" face="Arial, Helvetica, sans-serif"><b>/* create png 
        file */</b><br>
        chart.saveToFile(&quot;chart.png&quot;,&quot;PNG&quot;);<br>
        }</font></p>
      <p><font size="-1" face="Arial, Helvetica, sans-serif">catch(Exception e) 
        {<br>
        System.err.println(&quot;Error: &quot; + e.getMessage());<br>
        }<br>
        }<br>
        }</font></p>
    </blockquote>
  </blockquote>
</blockquote>
<p><font face="Arial, Helvetica, sans-serif" size="-1">You can also read the parameters 
  directly from a file:</font></p>
<blockquote> 
  <blockquote> 
    <blockquote> 
      <p><font size="-1" face="Arial, Helvetica, sans-serif">import com.java4less.rchart.*;</font></p>
      <p><font size="-1" face="Arial, Helvetica, sans-serif">public class test{<br>
        public test() {<br>
        }<br>
        public static void main(String[] args) {<br>
        try {</font></p>
      <p><font size="-1" face="Arial, Helvetica, sans-serif">ChartLoader loader=new 
        ChartLoader();<br>
        <b>// Set parameters</b><br>
        loader.setDataFile("examples\\piechart3D.txt"); <b>// this can also be 
        a url like http://www.myserver.com or file:///....</b></font></p>
      <p><font size="-1" face="Arial, Helvetica, sans-serif"><b>/* process parameters 
        and create chart*/</b><br>
        Chart chart=loader.buildChart(false,true); // true means read data file<br>
        chart.setSize(300,300);</font></p>
      <p><font size="-1" face="Arial, Helvetica, sans-serif"><b>/* create png 
        file */</b><br>
        chart.saveToFile(&quot;chart.png&quot;,&quot;PNG&quot;);</font></p>
      <p><font size="-1" face="Arial, Helvetica, sans-serif">}</font></p>
      <p><font size="-1" face="Arial, Helvetica, sans-serif">catch(Exception e) 
        {<br>
        System.err.println(&quot;Error: &quot; + e.getMessage());<br>
        }<br>
        }<br>
        }</font></p>
    </blockquote>
  </blockquote>
</blockquote>
<p>&nbsp;</p>
<p><font face="Arial, Helvetica, sans-serif" size="-1">In all cases the steps 
  are:</font></p>
<ol>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">Create the chart loader</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">Set the parameters or 
    load them from file</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">build the chart</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">export the chart to 
    an image file or display it using a Chart Viewer (see next sections)</font></li>
</ol>
<p>&nbsp;</p>
<h4><font face="Arial, Helvetica, sans-serif" size="-1"><a name="viewer"></a>Displaying 
  the chart (Chart viewer)</font></h4>
<font face="Arial, Helvetica, sans-serif" size="-1">RChart includes ready to use 
classes for displaying charts in Java applications. There are 3 different Chart 
Viewer for Swing , SWT and AWT:</font> 
<ul>
  <li> <font face="Arial, Helvetica, sans-serif" size="-1"><b>Swing</b> ChartViewer 
    (in com.java4less.rchart.swing): This class is a subclass of JPanel and can 
    be added to any Swing container. The viewer implements the following features: 
    </font> 
    <ul>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">It displays the 
        chart you set with the setChart() method.</font></li>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">It implements scroll 
        bars and zoom in/out buttons. </font></li>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">It can automatically 
        change the cursor when the pointer moves over a value in the chart.</font></li>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">the Chart class 
        will also trigger events and support realtime updates<br>
        <br>
        The following is a very simple Swing java program which uses the chart 
        viewer:</font><br>
        <br>
        <font face="Courier New, Courier, mono" size="-1">public class SimpleJExample 
        extends JFrame {<br>
        <br>
        JChartViewer chartViewer= new JChartViewer();<br>
        <br>
        <br>
        public SimpleJExample() {<br>
        this.setTitle(&quot;RChart for Swing example&quot;);<br>
        this.setResizable(false);<br>
        this.getContentPane().setLayout(new java.awt.BorderLayout());<br>
        this.setSize(new Dimension(500,500)); <br>
        this.getContentPane().add(&quot;Center&quot;, chartViewer);<br>
        <br>
        this.doLayout();<br>
        <br>
        // create default chart<br>
        ChartLoader loader=new ChartLoader();<br>
        loader.loadFromFile(&quot;examples/lineChart.txt&quot;,true);<br>
        chartViewer.setChart(loader.build(false,false));<br>
        this.show(); </font> 
        <p><font face="Courier New, Courier, mono" size="-1"> } </font></p>
        <p><font face="Courier New, Courier, mono" size="-1">}</font></p>
        <br>
        <font face="Arial, Helvetica, sans-serif" size="-1"><br>
        </font></li>
    </ul>
  </li>
  <li> <font face="Arial, Helvetica, sans-serif" size="-1"><b>SWT</b> ChartViewer 
    (in com.java4less.rchart.swt): This class is a SWT control which can be added 
    to any SWT Control or window. The viewer implements the following features: 
    </font> 
    <ul>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">It displays the 
        chart you set with the setChart() method.</font></li>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">It implements scroll 
        bars and zoom in/out buttons. </font></li>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">It can automatically 
        change the cursor when the pointer moves over a value in the chart.</font></li>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">the Chart class 
        will also trigger events and support realtime updates<br>
        <br>
        The following is a very simple SWT java program which uses the chart viewer:</font><br>
        <br>
        <font size="-1" face="Courier New, Courier, mono"><br>
        Display display = new Display();<br>
        // set Rchart SWT mode<br>
        GraphicsProvider.setMode(GraphicsProvider.MODE_SWT); <br>
        SwtGraphicsProvider.setDefaultDisplay(display);<br>
        <br>
        <br>
        Shell shell = new Shell(display);<br>
        shell.setSize(300,300);<br>
        shell.setBounds(100,100,400,400);<br>
        <br>
        // create chart<br>
        ChartLoader cloader=new ChartLoader();<br>
        cloader.loadFromFile(&quot;areaChart.txt&quot;,false); // load chart parameters 
        from file<br>
        Chart chart=cloader.build(false,false);<br>
        <br>
        // create chart viewer and set the chart<br>
        ChartViewer chartViewer=new ChartViewer(shell,SWT.NONE);<br>
        chartViewer.setBounds(0,0,400,400); <br>
        chartViewer.setChart(chart);<br>
        <br>
        shell.open();<br>
        <br>
        <br>
        while(!shell.isDisposed())<br>
        if(!display.readAndDispatch())<br>
        display.sleep();<br>
        display.dispose();<br>
        chart.dispose();<br>
        </font><br>
        <br>
      </li>
    </ul>
  </li>
  <li> <font face="Arial, Helvetica, sans-serif" size="-1"><b>AWT</b> ChartViewer 
    (in com.java4less.rchart.awt): This class is a subclass of java.awt.Panel 
    and can be added to any AWT container. The viewer implements the following 
    features: </font> 
    <ul>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">It displays the 
        chart you set with the setChart() method.</font></li>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">It implements scroll 
        bars and zoom in/out buttons. </font></li>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">It can automatically 
        change the cursor when the pointer moves over a value in the chart.</font></li>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">the Chart class 
        will also trigger events and support realtime updates.<br>
        <br>
        The following is a very simple AWT java program which uses the chart viewer: 
        </font> 
        <p><font face="Courier New, Courier, mono" size="-1">public class SimpleAwtExample 
          extends Frame {<br>
          <br>
          ChartViewer chartViewer= new ChartViewer();<br>
          <br>
          public static void main(String[] args) {<br>
          SimpleAwtExample demo=new SimpleAwtExample();<br>
          demo.show();<br>
          }<br>
          <br>
          public SimpleAwtExample() {<br>
          this.setTitle(&quot;RChart for AWT example&quot;); <br>
          this.setResizable(false);<br>
          this.setLayout(new java.awt.BorderLayout());<br>
          this.setSize(new Dimension(500,500)); <br>
          this.add(&quot;Center&quot;, chartViewer);<br>
          this.doLayout();<br>
          <br>
          // create chart<br>
          ChartLoader loader=new ChartLoader();<br>
          loader.loadFromFile(&quot;examples/lineChart.txt&quot;,true);<br>
          chartViewer.setChart(loader.build(false,false));<br>
          }<br>
          <br>
          }</font> </p>
      </li>
    </ul>
  </li>
</ul>
<h4>&nbsp;</h4>
<h4>&nbsp;</h4>
<h4><font face="Arial, Helvetica, sans-serif" size="-1"><a name="2"></a>Exporting 
  the chart to gif, png , jpg or bmp</font></h4>
<p><font face="Arial, Helvetica, sans-serif" size="-1">RChart can create the following 
  image files: JPG, PNG, BMP and GIF. This can be done by executing chart.saveToFile(filename,format), 
  where format can be &quot;GIF&quot;, &quot;PNG&quot;, &quot;BMP&quot; of &quot;JPG&quot;.</font></p>
<p><font face="Arial, Helvetica, sans-serif" size="-1"><b>AWT </b><br>
  <br>
  If you are using AWT or Swing you can use the GIF, JPG and PNG format. </font><font face="Arial, Helvetica, sans-serif" size="-1">The 
  JPG format is supported by Sun's java virtual machine 1.2 or later. The other 
  two formats require you to install a third party package:</font></p>
<ul>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">PNG (from Walter Brameld 
    , wbrameld4@yahoo.com): download it from http://209.51.137.74/pngencoder-1.0.jar</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">GIF: download gif encoder 
    from http://www.acme.com/resources/classes/Acme.tar.gz</font></li>
</ul>
<p><font face="Arial, Helvetica, sans-serif" size="-1">You must download one of 
  those packages and include them in your classpath.<br>
  <br>
  You can also use other encoders, In that case the source code would look like 
  this:</font></p>
<blockquote> 
  <blockquote> 
    <blockquote> 
      <p><font face="Arial, Helvetica, sans-serif" size="-1"><b>// create image</b> 
        <br>
        java.awt.image.BufferedImage image = new java.awt.image.BufferedImage( 
        chart.getWidth(),chart.getHeight(),java.awt.image.BufferedImage.TYPE_INT_RGB 
        );<br>
        <br>
        java.awt.Graphics imgGraphics = image.createGraphics();</font></p>
      <p><font size="-1" face="Arial, Helvetica, sans-serif"> <b>// paint chart 
        on image</b><br>
        ChartGraphics chartGraphics=GraphicsProvider.getGraphics(imgGraphics)<br>
        chart.paint( chartGraphics );<br>
        chartGraphics.dispose(); </font></p>
      <p><font size="-1" face="Arial, Helvetica, sans-serif"> <b>// open file</b><br>
        java.io.File f=new java.io.File(filename);<br>
        f.delete();<br>
        java.io.FileOutputStream outb=new java.io.FileOutputStream(f);</font></p>
      <p><font size="-1" face="Arial, Helvetica, sans-serif"><b>// encode image 
        using your encoder</b><br>
        com.company.Enconder encoder= new com.company.Enconder(image ,outb); // 
        encode the image to the output stream<br>
        encoder.encodeImage(); </font></p>
    </blockquote>
  </blockquote>
</blockquote>
<p><b>SWT</b></p>
<p><font face="Arial, Helvetica, sans-serif" size="-1">If you are using SWT, you 
  can use the JPG, GIF and BMP formats. No external packages are required.</font></p>
<p>&nbsp;</p>
<h4><font face="Arial, Helvetica, sans-serif" size="-1"><a name="4"></a>Updating 
  the chart and realtime updates</font></h4>
<p><font face="Arial, Helvetica, sans-serif" size="-1">There is a way to force 
  RChart to rebuild itself every X seconds. In this way you can create charts 
  that will get updated with realtime data. For example you can let RChart read 
  new data from a given URL or file every 5 seconds. Look at the same application 
  provided with the product to see a complete working example.</font></p>
<p><font face="Arial, Helvetica, sans-serif" size="-1">The following example shows 
  how to let RChart be updated every 5 seconds and load new data from a given 
  URL. </font></p>
<blockquote>
  <p><font face="Courier New, Courier, mono" size="-1">chartLoader.loadFromFile(&quot;file:///c:\\examples\\areaChart.txt&quot;,false);<br>
    Chart chart=cloader.build(false,false);<br>
    <br>
    ChartViewer chartViewer=new ChartViewer(shell,SWT.NONE);<br>
    chartViewer.setBounds(0,0,400,400); <br>
    chartViewer.setChart(chart);<br>
    <br>
    shell.open();</font></p>
  <p><font face="Courier New, Courier, mono" size="-1" color="#FF0000">// set 
    up realtime update<br>
    chart.msecs=5000; // update every 5 seconds<br>
    chart.reloadFrom=&quot;http://www.myserver.com/newdata.html&quot;; // get 
    new data from this url<br>
    chart.startUpdater(); // start update thread</font><font face="Courier New, Courier, mono" size="-1" color="#FF0000"></font><font face="Courier New, Courier, mono" size="-1"><br>
    <br>
    while(!shell.isDisposed())<br>
    if(!display.readAndDispatch())<br>
    display.sleep();<br>
    display.dispose();<br>
    chart.dispose();</font></p>
  </blockquote>
<p><font face="Arial, Helvetica, sans-serif" size="-1">Each time the chart gets 
  updated by the updater thread, RChart will trigger 2 events which can be catched 
  by <a href="chartInteractive.html">ChartListeners</a>. These events are:</font></p>
<ul>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">EVENT_BEFORE_UPDATE: 
    this event can be used by the listeners to set any new or updated parameters.</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">EVENT_AFTER_UPDATE: 
    this event is catched by the ChartViewer to refresh the control on the screen 
    after the chart has been updated. Your application will normally not take 
    any action when this event occurs.</font></li>
</ul>
<p><font face="Arial, Helvetica, sans-serif" size="-1">There are 2 ways for updating 
  the values in your chart (normally inside the EVENT_BEFORE_UPDATE event handler):</font></p>
<ol>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">If you have used the 
    ChartLoader to create your chart you can rebuild the same Chart object after 
    you have changed some of the parameters. For example:<br>
    <br>
    <br>
    <b><font face="Courier New, Courier, mono">// set new parameters, for example 
    update values in serie 1</font></b><font face="Courier New, Courier, mono"><br>
    myChart.loader.setParameter("SERIE_DATA_1","10|20|30 ....");</font></font> 
    <p><font size="-1" face="Courier New, Courier, mono"><b>// rebuild chart<br>
      // this is not required inside the EVENT_BEFORE_UPDATE event handler</b><br>
      myChart.loader.build(myChart,false,false); // since we pass the chart as 
      first parameter, the loader will not create a new Chart object but it will 
      rebuild the existing one</font><font size="-1" face="Arial, Helvetica, sans-serif"><br>
      <br>
      Note: if you are setting the new parameters inside the EVENT_BEFORE_UPDATE 
      event, you should not rebuild the chart yourself, instead you must set:<br>
      <br>
      <font face="Courier New, Courier, mono">myChart.autoRebuild=true;</font><br>
      <br>
      and the chart will be rebuilt automatically.<br>
      </font></p>
  </li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">Or you can use the Java 
    API to change the values in the chart. There are 2 methods specifically designed 
    for this:<br>
    <br>
    - Plotter.replaceSerie();<br>
    - DataSerie.replaceYvalueAt();<br>
    <br>
    You can change a given value in the data series using the following code:<br>
    <br>
    <font face="Courier New, Courier, mono">myChart.plotters[0].getSerie(0).replaceYValueAt(1,newValue); 
    // replace second value in serie 0</font><br>
    <br>
    or you can replace the whole series:<br>
    <br>
    <br>
    <font face="Courier New, Courier, mono">myChart.plotters[0].replaceSerie(0,yourDataSerie);</font><br>
    <br>
    the first 0 means you want to replace a serie in Plotter 0 (normally you only 
    have 1 plotter). The second 0 means you want to replace the first serie in 
    the given plotter. <br>
    <br>
    Note: if you are changing the chart inside the EVENT_BEFORE_UPDATE event, 
    you should disable the automatic chart rebuild with:<br>
    <br>
    <font face="Courier New, Courier, mono">myChart.autoRebuild=false;</font><br>
    <br>
    otherwise RChart would rebuild the chart using the original ChartLoader's 
    parameters and your changes would be overwritten.<br>
    <br>
    </font><font face="Arial, Helvetica, sans-serif" size="-1">We only recomment 
    to use the Java API if you are going to update values, not change the number 
    of values to plot. In the second case you may need to update the scale or 
    the labels and would be easier rebuilding the whole chart.</font></li>
</ol>
<h4><font face="Arial, Helvetica, sans-serif" size="-1"><a name="5"></a>Recompiling 
  RChart </font></h4>
<p><font face="Arial, Helvetica, sans-serif" size="-1">If you want to compile 
  from the command line you must do it like this:</font></p>
<ol>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">unzip all source code 
    files in a empty directory. Note that you must unzip it with subdirectories, 
    so you will get the source code under &quot;DIRECTORY/src/com/java4less/rchart&quot;.</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">Now you must edit the 
    following file:<br>
    <br>
    DIRECTORY/src/recompile.bat<br>
    <br>
    and modify the following lines:<br>
    <br>
    SET JDKHOME=C:\java\jdk<br>
    SET SWT_JAR=C:\java\swt\org.eclipse.swt.win32_3.0.0\ws\win32\swt.jar </font><font face="Arial, Helvetica, sans-serif" size="-1"><br>
    <br>
    JDKHOME must point to your JDK installation directory abd SWT_JAR must point 
    to the swt.jar file.<br>
    </font></li>
</ol>
<p>&nbsp; </p>
<p>&nbsp;</p>
</body>
</html>
